package com.basics.common.utils.weixin.model.menu;


/**
 * 	微信菜单
 *--------------------------------------------------->
 * @Author WangWei
 * @date 2018年9月9日 下午3:27:45
 * @version V1.0
 * @Email 1246518873@qq.com
 *--------------------------------------------------->
 * @Description:
 *
 *
 */
public class Menu {
	public final static String CLICK = "click"; // click菜单
	public final static String VIEW = "view"; // url菜单
	public final static String MINIPROGRAM = "miniprogram"; // url菜单
	public final static String SCANCODE_WAITMSG = "scancode_waitmsg"; // 扫码带提示
	public final static String SCANCODE_PUSH = "scancode_push"; // 扫码推事件
	public final static String PIC_SYSPHOTO = "pic_sysphoto"; // 系统拍照发图
	public final static String PIC_PHOTO_OR_ALBUM = "pic_photo_or_album"; // 拍照或者相册发图
	public final static String PIC_WEIXIN = "pic_weixin"; // 微信相册发图
	public final static String LOCATION_SELECT = "location_select"; // 发送位置

	private BasicButton[] button;

	public BasicButton[] getButton() {
		return button;
	}

	public void setButton(BasicButton[] button) {
		this.button = button;

	}

	public String toJSON() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("{");
		buffer.append("\"menu\":").append("{");
		buffer.append("\"button\":\"").append("[{");

		/*buffer.append(String.format("\"template_id\":\"%s\"", this.templateId)).append(",");
		buffer.append(String.format("\"url\":\"%s\"", this.url)).append(",");
		buffer.append(String.format("\"topcolor\":\"%s\"", this.topColor)).append(",");
		buffer.append("\"data\":{");
		TemplateParam param = null;
		for (int i = 0; i < this.templateParamList.size(); i++) {
		     param = templateParamList.get(i);
		    // 判断是否追加逗号
			if (i < this.templateParamList.size() - 1){

				buffer.append(String.format("\"%s\": {\"value\":\"%s\",\"color\":\"%s\"},", param.getName(), param.getValue(), param.getColor()));
			}else{
				buffer.append(String.format("\"%s\": {\"value\":\"%s\",\"color\":\"%s\"}", param.getName(), param.getValue(), param.getColor()));
			}

		}*/

		buffer.append("}]");
		buffer.append("}");
		buffer.append("}");
		return buffer.toString();
		}

}
